{{!

  Copyright (c) Facebook, Inc. and its affiliates.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

}}{{!
Generated Python classes for Thrift types
}}
{{> common/AutoGeneratedPy}}

import typing as _typing

{{#program:enums?}}
import enum

{{/program:enums?}}{{^program:enums?}}{{#program:unions?}}
import enum

{{/program:unions?}}{{/program:enums?}}
import thrift.py3lite.types as _fbthrift_py3lite_types
import thrift.py3lite.exceptions as _fbthrift_py3lite_exceptions
{{#program:include_namespaces}}
{{#has_types?}}

import {{#include_namespace}}{{value}}.{{/include_namespace}}lite_types as _{{#include_namespace}}{{value}}_{{/include_namespace}}lite_types
{{/has_types?}}
{{/program:include_namespaces}}
{{#program:enums}}


class {{enum:name}}(enum.{{!
        }}{{#enum:flags?}}Flag{{/enum:flags?}}{{!
        }}{{^enum:flags?}}Enum{{/enum:flags?}}):
    {{#enum:values}}
    {{enum_value:py_name}}: {{enum:name}} = ...
    {{/enum:values}}
    {{^enum:values}}
    pass
    {{/enum:values}}
{{/program:enums}}
{{#program:structs}}


class {{struct:name}}({{!
        }}{{#struct:union?}}_fbthrift_py3lite_types.Union{{/struct:union?}}{{!
        }}{{^struct:union?}}{{!
        }}{{#struct:exception?}}_fbthrift_py3lite_exceptions.GeneratedError{{/struct:exception?}}{{!
        }}{{^struct:exception?}}_fbthrift_py3lite_types.Struct{{/struct:exception?}}{{!
        }}{{/struct:union?}}{{!
        }}):
    {{#struct:fields_and_mixin_fields}}
    {{field:py_name}}: _typing.Final[{{^field:opt_in_req_out?}}_typing.Optional[{{/field:opt_in_req_out?}}{{!
            }}{{#field:type}}{{> types/PEP484Type}}{{/field:type}}{{!
            }}{{^field:opt_in_req_out?}}]{{/field:opt_in_req_out?}}] = ...
    {{/struct:fields_and_mixin_fields}}
    def __init__(
        self,{{#struct:fields?}} *{{/struct:fields?}}{{#struct:fields_and_mixin_fields}},
        {{field:py_name}}: _typing.Optional[{{#field:type}}{{> types/PEP484Type}}{{/field:type}}]=...{{/struct:fields_and_mixin_fields}}
    ) -> None: ...

    {{#struct:plain?}}
    def __call__(
        self,{{#struct:fields?}} *{{/struct:fields?}}{{#struct:fields_and_mixin_fields}},
        {{field:py_name}}: _typing.Optional[{{#field:type}}{{> types/PEP484Type}}{{/field:type}}]=...{{/struct:fields_and_mixin_fields}}
    ) -> {{struct:name}}: ...
    {{/struct:plain?}}
    {{#struct:union?}}

    class Type(enum.Enum):
        EMPTY: {{struct:name}}.Type = ...
    {{#struct:fields_and_mixin_fields}}
        {{field:py_name}}: {{struct:name}}.Type = ...
    {{/struct:fields_and_mixin_fields}}

    @classmethod
    def fromValue(cls, value: {{ > types/FieldValuePEP484UnionType}}) -> {{struct:name}}: ...
    value: _typing.Final[{{ > types/FieldValuePEP484UnionType}}]
    type: Type
    def get_type(self) -> Type:...
    {{/struct:union?}}
    {{^struct:union?}}
    def __iter__(self) -> typing.Iterator[typing.Tuple[str, {{ > types/FieldValuePEP484UnionType}}]]: ...
    {{/struct:union?}}
{{/program:structs}}
{{#program:constants?}}

{{#program:constants}}

{{constant:name}}: {{#constant:type}}{{> types/PEP484Type }}{{/constant:type}} = ...
{{/program:constants}}
{{/program:constants?}}
{{#program:typedefs?}}

{{#program:typedefs}}
{{typedef:name}} = {{#typedef:type}}{{> types/PythonType}}{{/typedef:type}}
{{/program:typedefs}}
{{/program:typedefs?}}
